package home5;

import org.junit.Test;

import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;
import java.util.ResourceBundle;

public class test {
 @Test
   public void RUN() throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
     Properties pt = new Properties();
      pt.load(new InputStreamReader(new FileInputStream("C:\\Users\\79007\\IdeaProjects\\homework14\\home14\\src\\home5\\ config.properties")));

     String className = pt.getProperty("className");
     System.out.println(className);
     File file = new File("src/home5/DemoClass.java");
     System.out.println(file.getAbsoluteFile());
     Class<?> aClass = Class.forName(className+"");
     DemoClass o = (DemoClass)aClass.getConstructor().newInstance();
     Method run = aClass.getMethod("run");
     run.invoke(o);



 }
}
